home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / 2DLab / misc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-14  |  953 b   |  39 lines

  1. #define ABS(A) ((A) < 0 ? (-(A)) : (A))
  2.  
  3. /* already defined in <c.h> on NeXT
  4.  *#define MAX(a,b) ((a) > (b) ? (a) : (b))
  5.  *#define MIN(a,b) ((a) < (b) ? (a) : (b))
  6.  */
  7.  
  8. #define AVG(a,b) (((a)+(b))*0.5)
  9.  
  10. #define HI(L)    (((L) >> 16) & 0x0000FFFF)
  11. #define LO(L)    ((L)        & 0x0000FFFF)
  12.  
  13. #define HI8(S)    (((S) >> 8)  & 0x000000FF)
  14. #define LO8(S)    ((S)        & 0x000000FF)
  15.  
  16. union intfloat {
  17.     int i;
  18.     float f;
  19. };
  20.  
  21. typedef union intfloat INTFLOAT;
  22.  
  23. /* typedef float (*FLOATLIST)[2];     pointer to list of pairs of floats */
  24. /* typedef double (*DOUBLELIST)[2];     pointer to list of pairs of doubles*/
  25.  
  26. #define islower(c) (c >= 'a' && c <= 'z')
  27. #define isupper(c) (c >= 'A' && c <= 'Z')
  28. #define isalpha(c) (islower(c) || isupper(c))
  29.  
  30. #define toupper(c) (islower(c) ? c - 'a' + 'A' : c)
  31. #define tolower(c) (isupper(c) ? c - 'A' + 'a' : c)
  32.  
  33. #define isnumeric(c) (c >= '0' && c <= '9')
  34.  
  35. #define SPACE '\ '
  36. #define TAB   '\t'
  37. #define NL    '\n'
  38. #define SLASH '\/'
  39.